{
  axios.defaults.baseURL = 'http://cba.itlike.com/public/index.php?s=/api/'
  const app = new Vue({
    el: '#app',
    created() {
      this.getDataList()
    },
    data: {
      indexData: 0,
      recommendList: [],
      goodsList: []
    },
    methods: {
      async getDataList() {
        const { data: res } = await axios.get('/category/list')
        console.log(res.data.list[0].children)
        // 获取推荐列表数据
        this.recommendList = res.data.list
        this.recommendList[0].parent_id = 1
        // 获取商品分类数据
        this.goodsList = res.data.list[0].children
      },
      change(id) {
        // 更改class
        this.indexData = id
        // 更改右侧数据
        this.goodsList = this.recommendList[id].children
      },
      gogogo(id) {
        localStorage.setItem('category_id', id)
        location.href = './goods/goodslist.html'
      }
    }
  })
}
